import { CheckCircle, Clock, Calendar, AlertCircle } from 'lucide-react'
import { getTimeLabelInfo } from '../../utils/timeUtils'

interface TimeLabelProps {
  task: any
  className?: string
}

function TimeLabel({ task, className = '' }: TimeLabelProps) {
  const timeLabel = getTimeLabelInfo(task)
  
  if (!timeLabel) return null
  
  // 图标映射
  const iconMap: { [key: string]: any } = {
    'CheckCircle': CheckCircle,
    'Clock': Clock,
    'Calendar': Calendar,
    'AlertCircle': AlertCircle
  }
  const IconComponent = iconMap[timeLabel.icon] || Calendar
  
  return (
    <span className={`inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium border ${
      timeLabel.color
    } ${timeLabel.urgent ? 'animate-pulse' : ''} ${className}`}>
      <IconComponent size={12} />
      <span>{timeLabel.text}</span>
    </span>
  )
}

export default TimeLabel
